<template>
	<view>
		<view class="page_view head">
			<view class=" head_view">
				<text>订单编号：</text>
				<text>{{data.orderSn}}</text>
			</view>
			<view class="head_view">
				<text>申请时间：</text>
				<text>{{data.createTime}}</text>
			</view>
		</view>
		<view class="page_view">
			<view class="text">审核</view>
			<u-steps :list="numList" :current="current"></u-steps>
		</view>
		<view class="page_view">
			<view class="text">问题描述</view>
			<text>{{data.reason}}</text>
		</view>
		<view class="page_view" v-if="data.status==1||data.status==2||data.status==3">
			<view class="text">审核留言</view>
			<text>{{data.handleNote}}</text>
		</view>
		<view class="page_view"  v-if="data.status==1||data.status==2">
			<view class="text">退货注意</view>
			<text>留字条写明退货原因和账号，放在商品旁一起打包发送</text>
		</view>
		<view class="page_view head" v-if="data.status==1||data.status==2">
			<view class="text">退货地址</view>
			<view class=" head_view">
				<text>退货地址：</text>
				<text>{{data.omsCompanyAddress.province}}{{data.omsCompanyAddress.city}}{{data.omsCompanyAddress.region}}{{data.omsCompanyAddress.detailAddress}}</text>
			</view>
			<view class="head_view">
				<text>姓名：</text>
				<text>{{data.omsCompanyAddress.name}}</text>
			</view>
			<view class="head_view">
				<text>手机号码：</text>
				<text>{{data.omsCompanyAddress.phone}}</text>
			</view>
		</view>
		<u-no-network tips="哎呀，网络信号丢失"></u-no-network>
		
		<failTimeout v-show="failTimeout"></failTimeout>
	</view>
</template>

<script>
	import OmsPortalOrderReturnApplyController from '../../api/OmsPortalOrderReturnApplyController.js'
	import {
		formatDate
	} from '../../utils/date.js'
	export default {
		data() {
			return {
				failTimeout:false,
				id: null,
				numList: [],
				data: {},
				current:1,
			}
		},
		onLoad(o) {
			this.id = o.id
		},
		async onShow() {
			await OmsPortalOrderReturnApplyController.getById(this.id).then(res => {
				if (res.data.code == 200) {
					res.data.data.createTime = formatDate(new Date(res.data.data.createTime), 'yyyy-MM-dd hh:mm:ss')
					this.current=res.data.data.status+1;
					this.data = res.data.data

					if (res.data.data.status != 3) {
						this.numList.push({
							name: '申请'
						}, {
							name: '审核中'
						}, {
							name: '退货中'
						}, {
							name: '已完成'
						}, )
					}else{
						this.numList.push({
							name: '申请'
						}, {
							name: '审核中'
						}, {
							name: '已拒绝'
						} )
					}
				}
			}).catch(err => {
				if(err.errMsg=='request:fail timeout'){
					this.failTimeout=true
				}
			})
		},
		methods: {

		}
	}
</script>
<style>
	page {
		background-color: rgb(240, 240, 240);
	}
</style>
<style scoped>
	.page_view {
		margin: 20rpx;
		background-color: #fff;
		padding: 20rpx;
	}

	.head .head_view {
		padding: 20rpx;
	}

	.page_view .text {
		border-bottom: 1px solid #dcdcdc;
		padding: 20rpx 0;
		margin-bottom: 30rpx;

	}
</style>
